package day4;

import org.junit.Test;

public class Demo {
	@Test
	public void test1() {
		// The field Student.id is not visible
		Student student = new Student();
		student.setId(1);
		student.setName("zhangsan");
		student.setAge(23);
		student.setGender("男");
		// 调用方法：对象.方法名
		student.study();
		
		Student student2 = new Student();
		student2.setId(2);
		student2.setName("lisa");
		student2.setAge(23);
		student2.setGender("女");
		student2.study();
	}
	
	@Test
	public void test2() {
		Student student = new Student();
		student.setAge(23);
		student.setId(1);
		student.setName("王涵宇");
		student.setGender("女");
		int id = student.getId();
		int age = student.getAge();
		String name = student.getName();
		String genger = student.getGender();
		System.out.println(id + " " + age + " " + name + " " + genger);	
		System.out.println(student.toString());
	}
	
	
	@Test
	public void test3() {
		Teacher teacher = new Teacher();
		System.out.println(teacher.age);
		teacher = null;
		System.out.println(teacher);
		System.out.println(teacher.age);
		
	}
	
	@Test
	public void test4() {
		Student student = new Student(2, 23);
		int age = student.getAge();
		System.out.println(student);	
	}
}
